<template>
  <div class="line-echart">
    <BaseEchart :options="options" />
  </div>
</template>

<script lang="ts" setup>
import { computed, defineProps } from 'vue'
import type { PropType, ComputedRef } from 'vue'

import type { EChartsOption } from 'echarts'
import BaseEchart from '@/base-ui/echart'

interface ILineData {
  xLabels: string[]
  values: any[]
}
const props = defineProps({
  lineData: {
    type: Object as PropType<ILineData>,
    required: true
  }
})
const options: ComputedRef<EChartsOption> = computed(() => ({
  tooltip: {
    trigger: 'axis'
  },
  xAxis: {
    type: 'category',
    boundaryGap: false,
    data: props.lineData.xLabels
  },
  yAxis: {
    type: 'value'
  },
  series: [
    {
      data: props.lineData.values,
      type: 'line',
      areaStyle: {}
    }
  ]
}))
</script>

<style lang="less" scoped></style>
